#!/usr/bin/env
#

user="dbuser"
password="123456"
host="localhost"
database="school"
table="student1"

mysql_conn="mysql -u"$user" -p"$password" -h"$host""

cat data.txt | while read id name birth sex
do
  if [ "$id" -gt 1014 ];then
    $mysql_conn -e "INSERT INTO $database.$table values('$id','$name','$birth','$sex')"
    # $database. 就等同于 -D$database
  fi
done
